import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class BookImformation {
    public static void main(String[] args) {
        String book = "书名:java程序设计:出版时间:2011.10.01;出版社:清华大学出版社;价格:20.8元;页数389页.";
        String regex = "程序";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(book);
        if(matcher.find())
            System.out.println("书名带有程序");
        else
            System.out.println("书名不带有程序");
        regex = "\\d+\\.\\d+\\.\\d+";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(book);
        if(matcher.find())
            System.out.println("出版日期：" + matcher.group());
        regex = "\\d+元";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(book);
        String moneytmp =new String();
        if (matcher.find())
            moneytmp = matcher.group();
        regex = "\\d+";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(moneytmp);
        String money =new String();
        if (matcher.find())
            money = matcher.group();
        int yuna = Integer.parseInt(money);
        if(yuna > 29)
            System.out.println("价格大于29");
        else
            System.out.println("价格小于29");
        regex = "\\d+页";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(book);
        String papertmp =new String();
        if (matcher.find())
            papertmp = matcher.group();
        regex = "\\d+";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(papertmp);
        String paper =new String();
        if (matcher.find())
            money = matcher.group();
        int ye = Integer.parseInt(money);
        if(ye > 360)
            System.out.println("价格大于360");
        else
            System.out.println("页数小于360");

    }
}
